home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacHack 1997
/
MacHack 1997.toast
/
Hacks
/
Hacks ’93
/
Inside Mac Movie Toolbox Code
/
mtb3.c
< prev
next >
Wrap
Text File
|
1992-10-22
|
2KB
|
84 lines
// Copyright: © 1992 by Apple Computer, Inc., all rights reserved.
#include "mtb.h"
void main (void)
{
MovieController aController;
WindowPtr aWindow;
Rect aRect;
Movie aMovie;
Boolean done = false;
OSErr err;
EventRecord theEvent;
WindowPtr whichWindow;
short part;
InitGraf (&qd.thePort);
InitFonts ();
InitWindows ();
InitMenus ();
TEInit ();
InitDialogs (nil);
if (!IsQuickTimeInstalled()) {
CheckError(-1,"\pPlease install QuickTime and try again.");
}
err = EnterMovies ();
if (err) return;
SetRect (&aRect, 100, 100, 200, 200);
aWindow = NewCWindow (nil, &aRect, "\pMovie",
false, noGrowDocProc,
(WindowPtr)-1, true, 0);
SetPort (aWindow);
aMovie = GetMovie ();
if (aMovie == nil) return;
SetRect(&aRect, 0, 0, 100, 100);
aController = NewMovieController (aMovie, &aRect, mcTopLeftMovie);
if (aController == nil) return;
err = MCGetControllerBoundsRect(aController, &aRect);
SizeWindow (aWindow, aRect.right,
aRect.bottom, true);
ShowWindow (aWindow);
err = MCDoAction (aController,
mcActionSetKeysEnabled, (Ptr) true);
while (!done) {
WaitNextEvent(everyEvent, &theEvent, 0, nil );
if (!MCIsPlayerEvent(aController, &theEvent)) {
switch (theEvent.what) {
case updateEvt:
whichWindow = (WindowPtr)theEvent.message;
BeginUpdate (whichWindow);
EraseRect (&whichWindow->portRect);
EndUpdate (whichWindow);
break;
case mouseDown:
part = FindWindow (theEvent.where,
&whichWindow);
if (whichWindow == aWindow) {
switch (part) {
case inGoAway:
done = TrackGoAway (whichWindow,
theEvent.where);
break;
case inDrag:
DragWindow (whichWindow,
theEvent.where,
&qd.screenBits.bounds);
break;
}
}
}
}
}
DisposeMovieController (aController);
DisposeMovie (aMovie);
DisposeWindow(aWindow);
}